$(document).ready(function() {	
	$.cookie('AUTOLOAD_BLOG', 1);
	$(window).scroll(function(){			
		if  ($(window).scrollTop() == $(document).height() - $(window).height()){
			loadBlogUser();
		}
	}); 
});
function loadBlogUser() {	
	var intPage 	= $('#ppage').val();	
	var strUserId	= $('#puserid').val();	
	var strTime		= $('#stime').val();	
	if($.cookie('AUTOLOAD_BLOG') == 1 && intPage > 0) {		
		$.cookie('AUTOLOAD_BLOG',0);	
		$('.boxBlog .loading').show();
		$.getJSON(				
			HOST_VFRIEND + 'ajax/blog?act=4&page='+intPage+'&stime='+strTime+'&uid='+strUserId+'&callback=?',		
			function(response) {	
				var msg 	= response['msg'];
				var error	= response['error'];
				if(error == 0) {
					$('#ppage').remove();
					$('.boxBlog .loading').remove();					
					$('.boxBlog #blogItem').append(response['dblog']);
				} else {
					alert(msg);
				}
				$.cookie('AUTOLOAD_BLOG', 1);
			}
		);
	}
}